﻿using System.Linq;
using IterationLife.FootballTeaching.Models;
using IterationLife.FootballTeaching.Repositories;
using Util;
using Util.Datas.Ef;

namespace IterationLife.Datas.Repositories.FootballTeachings {
    /// <summary>
    /// 课程仓储
    /// </summary>
    public class CourseRepository : RepositoryBase<Course>, ICourseRepository {
        /// <summary>
        /// 初始化课程仓储
        /// </summary>
        /// <param name="unitOfWork">工作单元</param>
        public CourseRepository( IApplicationUnitOfWork unitOfWork ) : base( unitOfWork ) {
        }

        /// <summary>
        /// 获取排序号
        /// </summary>
        public int GetSortId()
        {
            return Find().Max(t => t.SortId).SafeValue() + 1;
        }
    }
}
